package co.fitstart.entity.user.agent;

import com.demo2do.core.utils.Alias;

@Alias(value = "discountType")
public enum DiscountType {
    
    DISCOUNT("discount", "固定折扣"),
    
    PAYMENT("payment", "固定金额");
    
    private String alias;
    
    private String description;
    
    private DiscountType(String alias, String description) {
        this.alias = alias;
        this.description = description;
    }
    
    /**
     * 
     * @param alias
     * @return
     */
    public static DiscountType aliasOf(String alias) {
        for (DiscountType discountType : DiscountType.values()) {
            if (discountType.getAlias().equalsIgnoreCase(alias)) {
                return discountType;
            }
        }
        
        return null;
    }
    
    /**
     * 
     * @return
     */
    public boolean isDiscount() {
        return this.equals(DiscountType.DISCOUNT);
    }
    
    /**
     * 
     * @return
     */
    public boolean isPayment() {
        return this.equals(DiscountType.PAYMENT);
    }

    /**
     * @return the alias
     */
    public String getAlias() {
        return alias;
    }

    /**
     * @return the description
     */
    public String getDescription() {
        return description;
    }

    /**
     * @param alias the alias to set
     */
    public void setAlias(String alias) {
        this.alias = alias;
    }

    /**
     * @param description the description to set
     */
    public void setDescription(String description) {
        this.description = description;
    }
    
    

}
